# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# NOTE: This class is auto generated by the swagger code generator program.
# https://github.com/swagger-api/swagger-codegen.git
# Do not edit the class manually.

defmodule GoogleApi.CloudUserAccounts.Vm_alpha.Api.Linux do
  @moduledoc """
  API calls for all endpoints tagged `Linux`.
  """

  alias GoogleApi.CloudUserAccounts.Vm_alpha.Connection
  import GoogleApi.CloudUserAccounts.Vm_alpha.RequestBuilder


  @doc """
  Returns a list of authorized public keys for a specific user account.

  ## Parameters

  - connection (GoogleApi.CloudUserAccounts.Vm_alpha.Connection): Connection to server
  - project (String): Project ID for this request.
  - zone (String): Name of the zone for this request.
  - user (String): The user account for which you want to get a list of authorized public keys.
  - instance (String): The fully-qualified URL of the virtual machine requesting the view.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String): Data format for the response.
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
    - :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
    - :login (Boolean): Whether the view was requested as part of a user-initiated login.

  ## Returns

  {:ok, %GoogleApi.CloudUserAccounts.Vm_alpha.Model.LinuxGetAuthorizedKeysViewResponse{}} on success
  {:error, info} on failure
  """
  @spec clouduseraccounts_linux_get_authorized_keys_view(Tesla.Env.client, String.t, String.t, String.t, String.t, keyword()) :: {:ok, GoogleApi.CloudUserAccounts.Vm_alpha.Model.LinuxGetAuthorizedKeysViewResponse.t} | {:error, Tesla.Env.t}
  def clouduseraccounts_linux_get_authorized_keys_view(connection, project, zone, user, instance, opts \\ []) do
    optional_params = %{
      :"alt" => :query,
      :"fields" => :query,
      :"key" => :query,
      :"oauth_token" => :query,
      :"prettyPrint" => :query,
      :"quotaUser" => :query,
      :"userIp" => :query,
      :"login" => :query
    }
    %{}
    |> method(:post)
    |> url("/{project}/zones/{zone}/authorizedKeysView/{user}", %{
         "project" => URI.encode_www_form(project),
         "zone" => URI.encode_www_form(zone),
         "user" => URI.encode_www_form(user)
       })
    |> add_param(:query, :"instance", instance)
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.CloudUserAccounts.Vm_alpha.Model.LinuxGetAuthorizedKeysViewResponse{})
  end

  @doc """
  Retrieves a list of user accounts for an instance within a specific project.

  ## Parameters

  - connection (GoogleApi.CloudUserAccounts.Vm_alpha.Connection): Connection to server
  - project (String): Project ID for this request.
  - zone (String): Name of the zone for this request.
  - instance (String): The fully-qualified URL of the virtual machine requesting the views.
  - opts (KeywordList): [optional] Optional parameters
    - :alt (String): Data format for the response.
    - :fields (String): Selector specifying which fields to include in a partial response.
    - :key (String): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
    - :oauth_token (String): OAuth 2.0 token for the current user.
    - :pretty_print (Boolean): Returns response with indentations and line breaks.
    - :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
    - :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
    - :filter (String): Sets a filter expression for filtering listed resources, in the form filter&#x3D;{expression}. Your {expression} must be in the format: field_name comparison_string literal_string.  The field_name is the name of the field you want to compare. Only atomic field types are supported (string, number, boolean). The comparison_string must be either eq (equals) or ne (not equals). The literal_string is the string value to filter to. The literal value must be valid for the type of field you are filtering by (string, number, boolean). For string fields, the literal value is interpreted as a regular expression using RE2 syntax. The literal value must match the entire field.  For example, to filter for instances that do not have a name of example-instance, you would use filter&#x3D;name ne example-instance.  Compute Engine Beta API Only: If you use filtering in the Beta API, you can also filter on nested fields. For example, you could filter on instances that have set the scheduling.automaticRestart field to true. In particular, use filtering on nested fields to take advantage of instance labels to organize and filter results based on label values.  The Beta API also supports filtering on multiple expressions by providing each separate expression within parentheses. For example, (scheduling.automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are treated as AND expressions, meaning that resources must match all expressions to pass the filters.
    - :max_results (Integer): The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.
    - :order_by (String): Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name.  You can also sort results in descending order based on the creation timestamp using orderBy&#x3D;\&quot;creationTimestamp desc\&quot;. This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first.  Currently, only sorting by name or creationTimestamp desc is supported.
    - :page_token (String): Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.

  ## Returns

  {:ok, %GoogleApi.CloudUserAccounts.Vm_alpha.Model.LinuxGetLinuxAccountViewsResponse{}} on success
  {:error, info} on failure
  """
  @spec clouduseraccounts_linux_get_linux_account_views(Tesla.Env.client, String.t, String.t, String.t, keyword()) :: {:ok, GoogleApi.CloudUserAccounts.Vm_alpha.Model.LinuxGetLinuxAccountViewsResponse.t} | {:error, Tesla.Env.t}
  def clouduseraccounts_linux_get_linux_account_views(connection, project, zone, instance, opts \\ []) do
    optional_params = %{
      :"alt" => :query,
      :"fields" => :query,
      :"key" => :query,
      :"oauth_token" => :query,
      :"prettyPrint" => :query,
      :"quotaUser" => :query,
      :"userIp" => :query,
      :"filter" => :query,
      :"maxResults" => :query,
      :"orderBy" => :query,
      :"pageToken" => :query
    }
    %{}
    |> method(:post)
    |> url("/{project}/zones/{zone}/linuxAccountViews", %{
         "project" => URI.encode_www_form(project),
         "zone" => URI.encode_www_form(zone)
       })
    |> add_param(:query, :"instance", instance)
    |> add_optional_params(optional_params, opts)
    |> Enum.into([])
    |> (&Connection.request(connection, &1)).()
    |> decode(%GoogleApi.CloudUserAccounts.Vm_alpha.Model.LinuxGetLinuxAccountViewsResponse{})
  end
end
